import { betweenTwoDateDetails } from "@/utils/date";
import dayjs from "dayjs";

/**
 * @param model 构建排班接口需要的参数
 */
export const buildArrangeModel = (model) => {
    if (!model) {
        return model;
    }

    return {
        'workdays': betweenTwoDateDetails(model.workDate[0], model.workDate[1]),
        'temporaryClass': {
            'id': model.id,
            'name': model.name,
            'color': model.color,
            'startTime': dayjs(model.workTime[0]).format('HH:mm'),
            'endTime': dayjs(model.workTime[1]).format('HH:mm'),
        },
        'staffIds': model.staffIds,
        'strategy': 'cycleMatch',
    };
}